
    <script src="{$assets}/js/datatables/js/jquery.dataTables.min.js"></script>

    <!-- Imported scripts on this page -->
    <script src="{$assets}/js/datatables/dataTables.bootstrap.js"></script>
    <script src="{$assets}/js/datatables/yadcf/jquery.dataTables.yadcf.js"></script>
    <script src="{$assets}/js/datatables/tabletools/dataTables.tableTools.min.js"></script>

    <script type="text/javascript">
    {literal}
    jQuery(document).ready(function($)
    {
        var selected = [];
        var detailRows = [];
        var table = $("#listdata").dataTable({
            "processing": true,
            "serverSide": true,
            "ajax": {
                "url": "admin/dong_xe/ajaxLoad",
                data: function(d) {
                    d.hang_id = $('[data-loadbody]').val();
                },
                "type": "GET",
                async: false
                /*success: function(response) {
                    console.log(response);
                }*/
            },
            "columns": [
                { 
                    "class": 'text-center',
                    "data": 'dong_id' ,
                    "orderable": false
                },
                { 
                    "data": 'thumb',
                    "orderable": false,
                    "render": function( data, type, full, meta) {
                        var str = "";
                        if(data !== null) {
                            str = '<img src="' + data + '" alt="">';
                        }
                        return str;
                    }
                },
                { 
                    "data": 'dong_name' ,
                    "orderable": true,
                    "render": function ( data, type, full, meta ) {
                        return full.hang_name + ' ' + data;
                    }
                },
                { 
                    "data": 'desc',
                    "orderable": false,
                },
                { 
                    "data": 'rival',
                    "orderable": false,
                },
                {
                    "class":        "details-control",
                    "orderable":    false,
                    "data":         "dong_id", 
                    "render": function ( data, type, full, meta ) {
                        var str = "";
                        if(full.status == 1) {
                            str += '<a href="javascript:void(0);" class="btn btn-success btn-xs btn-icon icon-left" data-changeStatus=true data-ctrl="admin/dong_xe" data-status="'+full.status+'" data-id="" data-action="ajaxStatus/'+full.hang_id+'/'+full.dong_id+'" ><i class="fa fa-check"></i></a>';
                        } else {                            
                            str += '<a href="javascript:void(0);" class="btn btn-success btn-danger btn-xs btn-icon icon-left" data-changeStatus=true data-ctrl="admin/dong_xe" data-status="'+full.status+'" data-id="" data-action="ajaxStatus/'+full.hang_id+'/'+full.dong_id+'" ><i class="fa fa-close"></i></a>';
                        }
                        str += '<a href="admin/dong_xe/edit/'+data+'.html" class="btn btn-gray btn-xs btn-icon icon-left"><i class="fa-edit"></i></a>';
                        str += '<a onclick="conFirm(\''+full.hang_name + ' ' + full.dong_name+'\', \'admin/dong_xe/del/' + full.hang_id + '/' + data+'.html\');" class="btn btn-danger btn-xs btn-icon icon-left"><i class="fa-trash"></i></a>';
                        return str;
                    }
                }
            ],
            "columnDefs": [
                {
                    "targets": [-1],
                    "searchable": false,
                    "orderable" : false
                }
            ]
        });

        $(document).on('change', '[data-loadbody]', function() {
            $("#listdata").DataTable().ajax.reload();
        });

    });
    {/literal}
    </script>